#pragma once

class TextureUI
{
	ui32 m_curPage;

	Dialog* m_dialog;

	float m_intensity;
	float m_gradient;

	ui32 m_brushType;

	std::deque<TextureQuad<TextureUI>*> m_favourites;
	ui32 m_curPos;
	UIButton<TextureUI>* m_pNextT, *m_pPrevT;

	DialogText* m_iText, *m_gText, *m_tText;
	Checkbox<TextureUI>* m_pTexEnabled;
	RadioButton<TextureUI>* m_pCircle, *m_pSquare;

	std::set<std::string> m_tileSets;

	void NexTexProc(UIButton<TextureUI>*);
	void PrevTexProc(UIButton<TextureUI>*);

	void BruhshSelProc(RadioButton<TextureUI>* pRButton, bool check);

	void LoadButtonProc(UIButton<TextureUI>*);
	void IntensityProc(Scrollbar<TextureUI>* bar, ui32 m_value)
	{
		m_intensity = m_value / 10.0f;
		char msg[255];
		sprintf_s<255>(msg, "%s: %.02f", sLocale.GetLocale(2, "Intensity").c_str(), m_intensity);
		m_iText->szText = msg;
	}

	void GradientProc(Scrollbar<TextureUI>*, ui32 m_value)
	{
		m_gradient = m_value / 100.0f;
		char msg[255];
		sprintf_s<255>(msg, "%s: %.02f", sLocale.GetLocale(54, "Strength").c_str(), m_gradient);
		m_gText->szText = msg;
	}

	EditBox* m_zoneName;
	void TexQuadProc(TextureQuad<TextureUI>*)
	{
	}

	void SetTextureFlags(Checkbox<TextureUI>* box, ui32 checked);

	Texture* m_curTexture;
	Checkbox<TextureUI>* pL1, *pL2, *pL3, *pL4, *pFreeLayer;
	TextureQuad<TextureUI>* m_pCurQuad;

	void TexQuadClick(TextureQuad<TextureUI>*);
	void EnabledTexClick(Checkbox<TextureUI>*, ui32 check);

public:
	TextureUI();
	Texture* GetTexture() { return m_curTexture; }
	float GetGradient() { return m_gradient; }
	float GetIntensity() { return m_intensity; }
	void Toggle()
	{
		m_dialog->m_visible = !m_dialog->m_visible;
	}
	void AddFavourite(std::string str);
	bool IsTexEnabled() { return m_pTexEnabled->m_state > 0; }
	ui32 GetBrushType() { return m_brushType; }
	void DisableTexturing()
	{
		//m_pTexEnabled->m_state = 0;
	}
};